<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>YK Value-added System</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<link rel="stylesheet" type="text/css" href="css/admin.css" />
	<link rel="stylesheet" type="text/css" href="css/common.css" />
	<script src="js/json.js" type="text/javascript"></script>
	<script src="js/prototype.js" type="text/javascript"></script>
	<script src="<%=basePath%>js/Validator.js" type="text/javascript"></script>
	<script type="text/javascript">
		function check(){
			if(document.getElementById("account.company_name").value==""){
				alert("名称不能为空！");
				document.getElementById("account.company_name").focus();
				return false ;
			}
			if(document.getElementById("account.company_num").value==""){
				alert("编号不能为空！");
				document.getElementById("account.company_num").focus();
				return false ;
			}
			
			if(document.getElementById("account.rid").value==""){
				alert("公司所在区域不能为空！");
				document.getElementById("account.rid").focus();
				return false ;
			}
			if(document.getElementById("account.high_risk").value==""){
				alert("风险级别不能为空！");
				document.getElementById("account.high_risk").focus();
				return false ;
			}
			
			if(document.getElementById("account.offer_type").value==""){
				alert("报价方式不能为空！");
				document.getElementById("account.offer_type").focus();
				return false ;
			}
			if(document.getElementById("account.offer_call").value==""){
				alert("报价电话不能为空！");
				document.getElementById("account.offer_call").focus();
				return false ;
			}
			
			if(document.getElementById("account.email").value==""){
				alert("邮箱不能为空！");
				document.getElementById("account.email").focus();
				return false ;
			}
			if(document.getElementById("account.fax").value==""){
				alert("传真不能为空！");
				document.getElementById("account.fax").focus();
				return false ;
			}
			
			if(document.getElementById("account.address").value==""){
				alert("联系地址不能为空！");
				document.getElementById("account.address").focus();
				return false ;
			}
			if(document.getElementById("account.company_num").value==""){
				alert("编号不能为空！");
				document.getElementById("account.company_num").focus();
				return false ;
			}
			var judgment;
			var company_num=document.getElementById("account.company_num").value;
			var id=document.getElementById("account.id").value;
			var url1 = "<%=basePath%>admin/tongzhou/account!checkAccountByCode.action?company_num="+company_num+"&id="+id;
	        new Ajax.Request(url1,{method:'post',asynchronous:false,
	           	onComplete:function(json){
	           	judgment=json.responseText.parseJSON().judgment;
			    if(judgment=="0"){
			    	alert("编号不能重复！");
			    }
	           }
	        });
	        if(judgment=="0"){
	        	return false;
	        }
	        return true;
		}

	</script>
	
  </head>
  
  <body>
<table width="95%" border="0" align="center" cellspacing="0">
  <tr>
    <td height="30">
    	<table width="60%" border="0">
		     <tr>
		        	<td width="30"><img src="images/location_left.gif" width="24" height="30" /></td>
		        	<td>
		        		您当前的位置是：客户管理 -&gt;修改用户<br>
		        	</td>
		    </tr>
		    <tr>
		         	<td colspan="2"><hr width="100%" align="left"></td>
			</tr>
	    </table>
    </td>
  </tr>
  <tr>
    <td><form id="form1" name="form1" method="post" action="<%=basePath%>admin/tongzhou/account!editAccount.action" onsubmit="return check();">
      <table width="80%" border="0" cellspacing="3">
      	<tr>
          <td colspan="4"><font color="red" style="font-size:12px;"></font></td>
		</tr>
		<tr>
          <td width="100" align="right">
          	<span class="style">*</span>名称：
          </td>
          <td>
          	<input type="hidden" id="account.id" name="account.id" value="${account.id}" >
          	<input type="text" style="width:150px" id="account.company_name" name="account.company_name" maxlength="30" value="${account.company_name}" style="height: 25px;"/>
          </td>
          <td width="100" align="right">
          	<span class="style">*</span>编号：
          </td>
          <td>
          	<input type="text" style="width:150px" id="account.company_num" name="account.company_num" maxlength="30" value="${account.company_num}" style="height: 25px;"/>
          </td>
        </tr>
        <tr>
          <td width="100" align="right">
          	<span class="style">*</span>公司所在地域：
          </td>
          <td>
          	<s:select id="account.rid" name="account.rid" list="regions" listKey="id"  listValue="region_name" headerKey="" headerValue="--请选择--" />
          </td>
          <td width="100" align="right">
          	<span class="style">*</span>风险级别：
          </td>
          <td>
          	<s:select id="account.high_risk" name="account.high_risk" list="#{0:'普通',1:'高风险'}"  headerKey="" headerValue="--请选择--" />
          </td>
        </tr>
         <tr>
          <td width="100" align="right">
          	<span class="style">*</span>默认报价方式：
          </td>
          <td>
          	<s:select id="account.offer_type" name="account.offer_type" list="quot_types" listKey="id"  listValue="quot_type_name"  headerKey="" headerValue="--请选择--" />
          </td>
          <td width="100" align="right">
          	<span class="style">*</span>默认报价电话：
          </td>
          <td>
          	<input type="text" style="width:150px" id="account.offer_call" name="account.offer_call" maxlength="30" value="${account.offer_call}" style="height: 25px;"/>
          </td>
        </tr>
         <tr>
          <td width="100" align="right">
          	<span class="style">*</span>邮箱：
          </td>
          <td>
          	<input type="text" style="width:150px" id="account.email" name="account.email" maxlength="30" value="${account.email}" style="height: 25px;"/>
          </td>
          <td width="100" align="right">
          	<span class="style">*</span>传真：
          </td>
          <td>
          	<input type="text" style="width:150px" id="account.fax" name="account.fax" maxlength="30" value="${account.fax}" style="height: 25px;"/>
          </td>
        </tr>
        <tr>
          <td width="100" align="right">
          	<span class="style">*</span>联系地址：
          </td>
          <td>
          	<input type="text" style="width:150px" id="account.address" name="account.address" maxlength="30" value="${account.address}" style="height: 25px;"/>
          </td>
          <td width="100" align="right">
          	<span class="style">*</span>是否可用：
          </td>
          <td>
		   		<s:radio list="#{'Y':'可用','N':'不可用'}"  name="account.active"/>
          </td>
        </tr>

        <tr>
          <td style="width:100px" align="right">
          	备注：
          </td>
          <td colspan="3">
          	<textarea rows="3" cols="60" id="account.remark" name="account.remark">${account.remark}</textarea>
          </td>
        </tr>
		<tr>
          <td colspan="4"><hr width="100%" align="left"></td>
		</tr>
        <tr>
          <td align="right" colspan="2"><input type="submit" name="Submit" value="修改" class="Button" /></td>
          <td colspan="2"><input type="button" name="Submit22" value="返回" class="Button"  onclick="window.location='<%=basePath%>admin/tongzhou/account!listAccount.action'"/></td>
        </tr>
      </table>
        </form>
    </td>
  </tr>
</table>
</body>
</html>
